package com.mo.entity;

import lombok.Builder;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.Lock;
import java.util.function.BiFunction;

@Builder
public class AsyncQueue<E> {

    /**
     * 前缀
     */
    private String prefix;

    /**
     * 命名空间
     */
    private String namespace;

    /**
     * 并发限制
     */
    private int taskLimit;
    private Semaphore semaphore;

    /**
     * 消费端
     */
    private ExecutorService listener;
    /**
     * 消费任务
     */
    private BiFunction<E, Long, Object> task;


    /**
     * 锁
     */
    private Lock writeLock;
    private Lock readLock;
}